package com.huangjue.backend.mapper;

import com.huangjue.backend.entity.AgentProcess;
import org.apache.ibatis.annotations.*;

import java.util.List;

// Mapper接口
public interface AgentProcessMapper {

    // 基础CRUD操作
    @Insert("INSERT INTO agent_process(agent_result_id, agent_type, agent_process, create_time) " +
            "VALUES(#{agentResultId}, #{agentType}, #{agentProcess}, NOW())")
    @Options(useGeneratedKeys = true, keyProperty = "agentProcessId")
    int insert(AgentProcess record);

    @Select("SELECT * FROM agent_process WHERE agent_process_id = #{id}")
    AgentProcess selectById(Integer id);

    @Update("UPDATE agent_process SET agent_result_id = #{agentResultId}, " +
            "agent_type = #{agentType}, agent_process = #{agentProcess} " +
            "WHERE agent_process_id = #{agentProcessId}")
    int update(AgentProcess record);

    @Delete("DELETE FROM agent_process WHERE agent_process_id = #{id}")
    int deleteById(Integer id);

    int batchInsert(@Param("list") List<AgentProcess> agentProcessList);

}